package zigzag.designpattern.composite;

public class Branch extends Tree {
	
	public Branch(String name){
		this.name = name;
	}
	public void add(Tree t) {
		list.add(t);
	}

	public void printAll() {
		for (int i=0; i< list.size(); i++){
			System.out.println(name);
			System.out.println("|---");
			((Tree)list.get(i)).printAll();
		}

	}

	public void remove(Tree t) {
		if (list.contains(t))
			list.remove(t);

	}

}
